package com.dpp.dbase.result;

import java.io.Serializable;
import java.util.List;

import lombok.Data;

@Data
public class PdResult<T> implements Serializable {

    private Boolean status;//返回状态

    private String message;//返回消息

    private T data;//返回数据

    public PdResult(Boolean status) {
        this.status = status;
    }

    public PdResult(boolean status, String message) {
        this.status = status;
        this.message = message;
    }

    public PdResult(boolean status, java.lang.String message, T data) {
        this.status = status;
        this.message = message;
        this.data = data;
    }

    /**
     * 返回失败
     *
     * @param meaage
     * @param <T>
     * @return
     */
    public static <T> PdResult<T> Fail(String meaage) {
        return new PdResult<T>(false, meaage);
    }

    /**
     * 返回成功单条数据
     *
     * @param meaage
     * @param data
     * @param <T>
     * @return
     */
    public static <T> PdResult<T> success(String meaage, T data) {
        return new PdResult<T>(true, meaage, data);
    }

    /**
     * 成功标识
     *
     * @param <T>
     * @return
     */
    public static <T> PdResult<T> success() {
        return new PdResult<T>(true);
    }
}
